package com.lianzai.common.config;

import com.lianzai.common.interceptor.UserAuthInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * Created by zb on 15/6/2017.
 */

@Configuration
@ConditionalOnBean(value = {
        UserAuthInterceptor.class
})
public class MvcConfiguration extends WebMvcConfigurerAdapter {

    @Autowired
    private UserAuthInterceptor userAuthInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(userAuthInterceptor);
    }
}
